package game.craft.model;

import javax.swing.*;
import java.awt.*;

/**
 * Created by IntelliJ IDEA.
 * User: ccayirog
 * Date: Mar 27, 2011
 * Time: 10:35:05 PM
 * To change this template use File | Settings | File Templates.
 */
public abstract class AbstractItem implements Item {


    protected int x;
    protected int y;
    protected int width;
    protected int height;
    protected boolean exist;
    protected Image image;


    protected AbstractItem(String filename, int x, int y) {
        ImageIcon ii = new ImageIcon(filename);
        image = ii.getImage();
        width = image.getWidth(null);
        height = image.getHeight(null);
        exist = true;
        this.x = x;
        this.y = y;
    }


    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }

    public boolean isExist() {
        return exist;
    }

    public void setExist(boolean exist) {
        this.exist = exist;
    }

    public Image getImage() {
        return image;
    }

    public Rectangle getBounds() {
        return new Rectangle(x, y, width, height);
    }
}
